package org.devknights.android.andlib.launcher;

import org.devknights.android.andlib.storage.AppPrefs;

import android.app.Activity;
import android.os.Bundle;

public abstract class MainActivity extends Activity {

	private AppPrefs appPrefs;
	private final static String first = "FIRST_LAUNCH";

	protected void onCreate(Bundle instance) {
		super.onCreate(instance);
		appPrefs = new AppPrefs(this);

		boolean isFirstLaunch = appPrefs.getBoolean(first, true);
		if (isFirstLaunch) {
			appPrefs.putBoolean(first, false);
			firstLaunch();
		} else {
			launch();
		}
	}

	public abstract void launch();

	public abstract void firstLaunch();

	public AppPrefs getAppPrefs() {
		return appPrefs;
	}

}
